package board

import (
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/suite"
	"notabug.org/ropemann/imabon/src/common"
)

type BoardTestSuite struct {
	suite.Suite
}

func (s *BoardTestSuite) SetupSuite() {
	common.LoadConfig("../../../.env")
}

func (s *BoardTestSuite) TestGetAllBoards() {
	boards := GetAllBoards()
	assert.NotEmpty(s.T(), boards)
}

func (s *BoardTestSuite) TestGetAllBoardsFail() {
	os.Setenv("DB_PORT", "")
	assert.Panics(s.T(), func() { GetAllBoards() })
}

func TestBoardTestSuite(t *testing.T) {
	suite.Run(t, new(BoardTestSuite))
}
